<template>

  <el-row style="width:100%">
    <!-- <el-col :span="12">传智教育</el-col> -->
    <el-col :span="12" :class="{fontWeight :!isDept}">{{ treeNode.name }}</el-col>
    <el-col :span="12">
      <el-row type="flex" justify="end">
        <span class="manager">{{ treeNode.manager }}</span>
        <el-dropdown>
          <span>操作<i class="el-icon-arrow-down el-icon--right" /></span>
          <el-dropdown-menu slot="dropdown">
            <el-dropdown-item v-show="checkBtnPerm('add-department')" @click.native="addFn">添加子部门</el-dropdown-item>
            <el-dropdown-item v-if="isDept" v-show="checkBtnPerm('edit-department')" @click.native="editFn">编辑部门</el-dropdown-item>
            <el-dropdown-item v-if="isDept" v-show="checkBtnPerm('del-department')" @click.native="delFn">删除部门</el-dropdown-item>
          </el-dropdown-menu>
        </el-dropdown>
      </el-row>
    </el-col>
  </el-row>

</template>

<script>

export default {
  props: { treeNode: {
    type: Object,
    required: true
  },
  isDept: {
    default: true,
    type: Boolean
  }},
  methods: {
    // checkBtnPerm(type) {
    //   const points = this.$store.state.user.setUserInfo.roles.points
    //   console.log(points)
    //   return points.indexOf(type) !== -1
    // },
    addFn() {
      // console.log(this.treeNode.id)
      this.$emit('addEvent', this.treeNode.id)
    },
    delFn() {
      // console.log(this.treeNode.id)
      this.$emit('delEvent', this.treeNode.id)
    },
    editFn() {
      // console.log(this.treeNode.id)
      this.$emit('editEvent', this.treeNode.id)
    }
  }
}
</script>
<style lang="scss" scoped>
  .fontWeight {
    font-weight: 700;
  }
    .el-row {
      color: #000;
      font-size: 14px;
      .manager{
        margin-right: 15px;
      }
      span{
      color: #000;

      }
    }
  </style>
